using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Lidgren.Library.Network;
using System.Text;
using System.Net;
using SharpWind.Network;

namespace SharpWindServer
{
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault( false );

			Application.Idle += new EventHandler( OnApplicationIdle );

			Application.Run( new MainForm() );

			Server.Instance.Shutdown( Reason.ServerQuit );
		}

		private static void OnApplicationIdle( object sender, EventArgs e )
		{
			while( Win32.AppStillIdle )
			{
				Server.Instance.Update();
			}
		}
	}
}